<?php
/**
 * Created by PhpStorm.
 * User: 彭奇
 * Date: 2018/9/27
 * Time: 21:29
 */
$names=$_GET["name"];
$pass=$_GET["pass"];

try{
    $pdo = new PDO("mysql:dbname=test;host=127.0.0.1","root","");
    $pdo->exec("SET NAMES 'utf8';");
}catch (PDOException $e){
    echo "连接失败";
    var_dump($e);
}
$sql = "INSERT INTO pq_user(NAME,pass) VALUES('{$names}','{$pass}');";
$res = $pdo->exec($sql);
if($res > 0){
    echo "添加成功{$res}条数据";
}else{
    echo "添加失败";
    var_dump($pdo->errorInfo());
}